{template 'common/header'}
<ul class="nav nav-tabs">
    <li ><a href="{php echo $this->createWebUrl('members', array('op'=>'index'))}">客户列表</a></li>
    <li class="active"><a href="{php echo $this->createWebUrl('members', array('op'=>'add'))}">新增客户</a></li>
</ul>
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default">
            <div class="panel-heading">
                客户设置
            </div>
            <div class="panel-body">

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">客户名称</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="name" class="form-control" value="{$theone['name']}" placeholder="请输入客户名称" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">客户电话</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="phone" class="form-control" value="{$theone['phone']}" placeholder="请输入客户电话(唯一)"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属区域</label>
                    <div class="col-sm-9 col-xs-12">
                        <select class="form-control" name="region_id">
                            <option>请选择区域</option>
                            {loop $regions $region}
                            <option value="{$region['id']}" {if $region['id'] == $theone['region_id']} selected="selected" {/if} >{$region['name']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">备注</label>
                    <div class="col-sm-9 col-xs-12">
                        <input type="text" name="remark" class="form-control" value="{$theone['remark']}" placeholder="请输入备注" />
                    </div>
                </div>
                <!--<div class="form-group">-->
                    <!--<label class="col-xs-12 col-sm-3 col-md-2 control-label">客户类型</label>-->
                    <!--<div class="col-sm-9 col-xs-12">-->
                        <!--<select class="form-control" name="type">-->
                            <!--<option value="1">常规客户</option>-->
                            <!--<option value="2">一次性客户</option>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type='hidden' name='id' value="{$theone['id']}" />
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>

<script type="text/javascript">
    function message(msg) {
        require(['util'], function(util) {
            util.message(msg);
        });
    }
    $('form').submit(function() {
        if($.trim($(':text[name="name"]').val()) == '') {
            message('必须填写名称.', '', 'error');
            return false;
        }
//        if($.trim($(':text[name="phone"]').val()) == '') {
//            message('必须填写电话号码.', '', 'error');
//            return false;
//        }

        return true;
    });


</script>



{template 'common/footer'}